package com.clearance.mine_clearance.untils;

import com.alibaba.fastjson.JSON;
import com.clearance.mine_clearance.config.client.SdkClient;
import com.clearance.mine_clearance.entry.dto.BinanceSymbolPiceDto;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

public class BinanceSymbolPice {

    private static final String binanceUrl = "https://fapi.binance.com/fapi/v1/ticker/price?symbol=";

    private static  Map<String,String> headMap = new HashMap<>();
    static {
        headMap.put("content-type", "application/json");
    }

    public static void main(String[] args) {
        getBinanceSymbolPice("BTCUSDT");
    }

    public static void getBinanceSymbolPice(String symbol){
        String resultInfo = null;
        try {
            resultInfo = SdkClient.get(binanceUrl + symbol, headMap);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        BinanceSymbolPiceDto binanceSymbolPiceDto = JSON.parseObject(resultInfo, BinanceSymbolPiceDto.class);
        System.out.println(binanceSymbolPiceDto);
    }
}
















